Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

course project #28

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

course project #28

wants to merge 13 commits into from

Conversation

DeliriumInTheVoid
Copy link
Owner

@DeliriumInTheVoid DeliriumInTheVoid commented Sep 22, 2023

how to run

  1. start server
  2. start first client. when it connected press "c" to create a game session and join to it.
  3. after session created start second client. press "j" to join to the session created by the first client (its hardcoded for now)
  4. game session will start after all players joined in 3 sec
  5. play game

controls

  • WASD - to move tank
  • arrows "<-", "->" - to rotate turret
  • space to shot

game play
shot to your opponent until one's HP less or equal "0", you will take damage from all collisions. so you can ram you enemy if you have more HP, be careful with rock and edges, you will take damage from it either.

network
if you want to play on two PCs. You should rebuild clients and change ip for connection to the server ip where you are going to run it. Same with port, but server can be run with port configuration ./battle_tanks_server.exe -port xxxx
client line to change:

connection_service->get_connection().connect({ "localhost" }, 52000);

game play
battle tanks game play.webm

PS
unfortunately a lot of hardcode there and not all code refactored and split to the layers and appropriate classes, strong connectivity and communication between some parts of the code and no UI at all. But still it's playable.

#include "game/game_objects/forest_map_game_object.hpp"
#include "game/game_objects/game_object_frame_restorer_packet.hpp"

enum class player_game_state : unsigned int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That specifically states about the network state, should be depicted in its name as well.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

window->close();
}

if (player_state == player_game_state::main_lobby)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's better to move state's handling into its own function/classes

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


void set_text_color(sf::Text& text, const sf::Int32 current_hp)
{
if (current_hp > 50)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to have all settings like this one in one or more dedicated config files for easier track of all constants and fast configuration of the game flow from one place. Possibly moving it all into some sort of db later to configure them outside of the code

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


namespace bt
{
typedef std::uint32_t uuid;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants